home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / batchut / fdate61a.zip / FDATE.DOC < prev    next >
Text File  |  1992-02-15  |  48KB  |  1,211 lines

  1. FDATE      Version 6.1a                          Feb 14, 1992
  2. ===================================================================
  3. FDATE: a utility for date manipulation in batch files.
  4. ===================================================================
  5. Stephen Ferg             5113 N. 8th Road, Arlington, VA 22205-1201
  6. Voice (703) 525-2241     CompuServe 73377,1157
  7.  
  8. =======================================================================
  9. Format:
  10. FDATE /Ffunc /Adate /Bdate /Iformat /Oformat
  11.              /Nnum /Ddayofweek /Pstring /Sstring
  12. =======================================================================
  13.  
  14.  
  15. FDATE PARAMETERS
  16. ================
  17.  
  18. The parameters that are required depend on the function requested.
  19. Parameters that are specified, but not needed, are ignored.
  20. Executing FDATE without any parameters displays a brief help screen.
  21.  
  22. Parameters can be in any order and upper or lower case.
  23.      Note that although format specifications are not case sensitive,
  24.      they ARE "text sensitive".  If any characters are missing,
  25.      added, or mistyped, the format specification will be rejected.
  26.      (A common mistake is to enter "/format" instead of "/Fformat".
  27.       This mistake can be avoided by using the /Ff function alias.)
  28.  
  29.  /F  requests a particular FDATE function
  30.      If this parameter is not specified, or is specified incorrectly,
  31.      FDATE displays a help screen.  If you unexpectedly get the help
  32.      screen displayed, you probably have omitted the /F parameter.
  33.  
  34.  /N  number of days (always a number)
  35.  
  36.  /D  day-of-week number (used only with W function)
  37.  
  38.  /A  date A  (for date functions)
  39.  /B  date B  (for date functions)
  40.      If the /A parameter is omitted, /Atoday is assumed.
  41.      If the /B parameter is omitted, /Btoday is assumed.
  42.  
  43.  /A  number A  (for math functions)
  44.  /B  number B  (for math functions)
  45.  
  46.  /I  specifies format of input date(s)
  47.      If the /I parameter is omitted, /Imm-dd-ccyy is assumed.
  48.  
  49.  /O  specifies format of output date
  50.      If the /O parameter is omitted, /Od1 is assumed.
  51.  
  52.  /L  specifies language of output.
  53.      /Lus   US (American) English-language output
  54.      /Lfr   French-language output
  55.      If the /L parameter is omitted, /Lus [American English] is assumed.
  56.  
  57.  /V  specifies that output is to be placed in an environment variable
  58.      rather than written to standard output (i.e. to the screen).
  59.  
  60.  /P  specifies a prefix string for the output
  61.  /S  specifies a suffix string for the output
  62.      Maximum length for a prefix or suffix string is 80 bytes.
  63.      These optional parameters may always be specified or omitted.
  64.      They must be enclosed in single quotes, double quotes, or
  65.                   square brackets
  66.  
  67.      Note that "whitespace" will be removed from these strings,
  68.      so formatting of /P and /S strings cannot be controlled using
  69.      spaces.  To format strings, use periods or ASCII 255 (hex'ff')
  70.      as filler.
  71.  
  72.      EXAMPLES
  73.      FDATE /Ff   /At /Od1         /P"Today is "
  74.      FDATE /Fdif /At /B12-25-TTTT /S" days until Christmas"
  75.      FDATE /Fdif /At /B12-25-TTTT /P"It is " /S" days 'til Xmas"
  76.      FDATE /Ff       /A05-08-TTTT /S[ -- "Buffalo Bill's" birthday]
  77.  
  78.  
  79.  
  80. ERROR HANDLING
  81. ==============
  82.  
  83.    If FDATE detects an error:
  84.  
  85.      (1) it will return an errorlevel of 1 (rather than 0), and
  86.      (2) its output will be 3 lines:
  87.        * the word ERROR
  88.        * a DOS batch-file ECHO statement that displays an error message
  89.        * a DOS batch-file PAUSE statement
  90.  
  91.    If Fdate output is displayed directly, or redirected to NUL:
  92.    you can detect an error by testing the errorlevel for a value of 1.
  93.  
  94.    If Fdate output is piped to an environment manipulation utility such
  95.    as STRINGS or GET, the environment variable will be set to ERROR.
  96.    Errorlevel will be set by STRINGS/GET, and will probably be 0.
  97.    In such a case, the only way to detect an error is to test the
  98.    environment variable for the value ERROR.
  99.  
  100.    If FDATE output is redirected to a batch file, which is then
  101.    CALLed to set an environment variable, the batch file will:
  102.      * set the environment variable to ERROR,
  103.      * ECHO the error message, and
  104.      * pause.
  105.    You can detect an error by testing errorlevel for the value 1
  106.    either before or after you CALL the batch file.
  107.    You can detect an error by testing the environment variable for the
  108.    value ERROR, AFTER you have CALLed the batch file.
  109.  
  110. ----------------------------------------------------------------------
  111.  
  112.  EXAMPLE:
  113.    rem use FDATE to check validity of year in parm %1
  114.    Fdate /Ff /Imm-dd-ccyy /ATT-TT-%1 /Occyy /P"Received year parm: "
  115.    if errorlevel 1 echo Year parm [%1] is not valid.
  116.    if errorlevel 1 goto endit
  117.  
  118.  EXAMPLE:
  119.    rem use FDATE to verify %1, and GET to put it into %year%
  120.    Fdate /Ff /Imm-dd-ccyy /ATT-TT-%1 /Occyy | GET ZE /V%year% >nul
  121.    if (%year%)==(ERROR) echo Year parm [%1] is not valid.
  122.    if (%year%)==(ERROR) goto endit
  123.  
  124.  EXAMPLE:
  125.    rem use FDATE to verify %1, call a batch file to put it into %year%
  126.    Fdate /Ff /Imm-dd-ccyy /ATT-TT-%1 /Occyy /P"@set year=">junktemp.bat
  127.    call junktemp.bat
  128.    del  junktemp.bat
  129.    if errorlevel 1 echo Year parm [%1] is not valid.
  130.    if errorlevel 1 goto endit
  131.  
  132. SYMBOL CONVENTIONS
  133. ==================
  134.  
  135. The following symbols are used in specifying date formats:
  136.  
  137. SYMBOL  EXAMPLE   MEANING
  138. ------  -------   -------------------------------------
  139. cc        19      century
  140. yy        93      year
  141. mm        02      month
  142. zm         2      month without leading zero
  143. dd        08      day
  144. zd         8      day   without leading zero
  145. mn       February month name
  146. mn3      Feb      month name, first 3 characters only
  147. dow      Tuesday  day of week
  148. dow3     Tue      day of week, first 3 characters only
  149. dow#      3       day of week as a number (Sunday=1, Monday = 2, etc.)
  150. today             is a "pseudodate" representing the current date
  151. t                 is an alias for the "today" pseudodate
  152. hh:mm    09:05    hours and minutes
  153. hhmm     0905     hours and minutes
  154. ss        09      seconds
  155.  
  156.  
  157.  
  158. PSEUDODATES
  159. ===========
  160.  
  161. t (or today)
  162.           can be used with either /A or /B, e.g. /Atoday or /At.
  163.  
  164. EXAMPLE
  165.           rem Get the date that is 90 days from today
  166.           FDATE /Fadd /N90 /Atoday /Omm-dd-ccyy
  167.           FDATE /Fadd /N90 /At     /Omm-dd-ccyy
  168.  
  169.           rem determine if this year is a leapyear
  170.           FDATE /Ff /At /OLY
  171.  
  172. tt        when used in place of a 2-digit DD string, will cause
  173.           Fdate to use today's day-of-the-month.
  174.           Example:    FDATE /Ff /Imm-dd-ccyy /A01-tt-1992 /Od1
  175.  
  176. tt        when used in place of a 2-digit MM string, will cause
  177.           Fdate to use today's month.
  178.           Example:    FDATE /Ff /Imm-dd-ccyy /Att-01-1992 /Od1
  179.  
  180. tt        when used in place of a 2-digit YY string, will cause
  181.           Fdate to use today's year (CCYY).
  182.           Example:    FDATE /Ff /Imm-dd-yy /A01-01-tt /Od1
  183.  
  184.           Note that TT can NOT be used for only the YY part of a CCYY
  185.           input year.  The following, for example, is NOT valid:
  186.           Example:    FDATE /Ff /Imm-dd-ccyy /A01-01-19tt /Od1
  187.  
  188. tttt      when used in place of a 4-digit CCYY string, will cause
  189.           Fdate to use today's year (CCYY).
  190.           Example:    FDATE /Ff /Imm-dd-ccyy /A01-01-tttt /Od1
  191.  
  192.  
  193. EXAMPLES:
  194.  
  195. Show the first Monday in the second quarter of this year
  196. FDATE /Fw /Iccyymmdd /Atttt0301 /D2 /N1 /Od1 /P"First Monday in QTR#2: "
  197.  
  198. Show the last Friday on/before the 15th of this month.
  199. FDATE /Fw /Iccyymmdd /Atttttt15 /D6 /N-1 /Od1 /P"Friday before the 15th: "
  200.  
  201.  
  202. INPUT FORMATS
  203. =============
  204.  
  205. NOTE
  206. If ALL input dates are specified using the "today" pseudodate, (i.e.
  207. /At, /Bt) then it is not necessary to supply an input format using /I.
  208.  
  209. FORMAT      EXAMPLES      DISCUSSION
  210. ------      ---------     -----------------------------
  211. ccyymmdd    19922002
  212.  
  213. mm-dd-ccyy  02-20-1992    In an input format specification, the dash
  214.             02/20/1992    symbols represent ANY non-numeric symbol.
  215.  
  216.              2-5-1992     Leadin